@W-20224267 Passkey login in checkout#3585
@W-20224267 Passkey login in checkout#3585hajinsuha1 merged 34 commits intofeature/webauthn-loginfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…error handling - Integrated finishWebauthnAuthentication to complete the passkey login flow. - Improved error handling and logging for authentication processes. - Added helper functions for base64url encoding/decoding to facilitate credential processing.
…st environment settings
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore TODO: user_id is optional, but commerce-sdk-isomorphic expects it to be required. Remove this comment after commerce-sdk-isomorphic is updated. |
There was a problem hiding this comment.
need to remove this comment after commerce-sdk-isomorphic is updated with recent OAS change that makes user_id optional
| * SPDX-License-Identifier: BSD-3-Clause | ||
| * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
| */ | ||
| /* global PublicKeyCredential */ |
There was a problem hiding this comment.
currently eslint is using es6 which does not contain PublicKeyCredential.
This fix allows us to use it without updating the eslint config. Later we can speak to the PWA kit about upgrading but for now it seems this is the practice that is used for other similar variables
…er changes to isRegistered in a useEffect
This reverts commit 1b88a0e.
…and adjust registration check logic
…cted body, improving type safety and clarity.
| } catch (error) { | ||
| setError(formatMessage(API_ERROR_MESSAGE)) | ||
| } |
There was a problem hiding this comment.
here we catch any errors and that were thrown during the webauthn flow and display a generic error message. More detailed error handling will be done as part of https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002TfC8TYAV/view
… login, ensuring basket is merged for registered customers.
…in/registration pages to ensure consistent access through the window object.
packages/template-retail-react-app/app/hooks/use-passkey-login.js
Outdated
Show resolved
Hide resolved
| const uint8arrayToBase64url = (input) => { | ||
| const uint8array = new Uint8Array(input) | ||
| const base64 = base64Encode(uint8array.buffer) | ||
| return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '') | ||
| } |
There was a problem hiding this comment.
We don't have to address this in this PR but it seems this util function is used across multiple components for webauthn. We should consider placing this in a utils module
packages/template-retail-react-app/app/hooks/use-passkey-login.test.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Jinsu Ha <91205717+hajinsuha1@users.noreply.github.com>
… ArrayBuffer to base64url conversion, improving code reusability and clarity. Add unit tests for the new utility function.
….com/SalesforceCommerceCloud/pwa-kit into W-20224267-passkey-login-in-checkout
…rphic has been updated
Description
Integrates the passkey login flow into the checkout page.
Types of Changes
Changes
usePasskeyLoginhook to be used to initiate passkey loginHow to Test-Drive This PR
navigate to https://wasatch-mrt-jinsu.sfdc-shbmgi-ecom1.exp-delivery-staging-ci.com/
No Passkey Registered
Passkey Registered
Error messages
Passkey feature disabled
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization